if (kind = PicKind) or (kind = ProfilePlotKind) or (kind = CalibrationPlotKind) or (kind = HistoKind) or (Kind = PasteControlKind) or (Kind = ResultsKind) or (Kind = TextKind) then
if (ImportCustomDepth <> EightBits) and (ImportCustomWidth > MaxLine) then begin
PutMessage(concat('Maximum width of imported 16-bit images is ', long2str(MaxLine), '.'));
exit(ImportFile);
end;
WhatToOpen := OpenCustom;
end;
ImportLUT: begin
DoImportLut(FileName, RefNum);
exit(ImportFile);
end;
ImportText: begin
ImportFile := ImportTextFile(FileName, RefNum);
exit(ImportFile);
end;
end;
if ImportAll then
ImportAllFiles(RefNum)
else if (WhatToOpen = OpenCustom) and (ImportCustomDepth <> EightBits) then
b := Import16BitFile(FileName, RefNum)
else
b := OpenFile(FileName, RefNum);
if ImportingTIFF then
WhatToImport := ImportTiff;
end;
procedure RevertToSaved;
var
fname: str255;
err, f: integer;
ok: boolean;
begin
if OpPending then
KillRoi;
DisableDensitySlice;
with Info^ do begin
fname := title;
SetPort(wptr);
if PictureType = PICTFile then begin
ok := OpenPICT(fname, vref, true);
UpdatePicWindow;
end
else begin
ShowWatch;
err := fsopen(fname, vref, f);
ok := true;
if HeaderOffset <> -1 then
ok := OpenImageHeader(f, fname, vref);
if ok then begin
err := SetFPos(f, fsFromStart, ImageDataOffset);
err := fsread(f, ImageSize, PicBaseAddr);
with info^ do
if (PictureType = PDP11) or (PictureType = InvertedTIFF) then
InvertPic;
if odd(PixelsPerLine) then
UnpackLines;
UpdatePicWindow;
end;
err := fsclose(f);
RoiShowing := false;
end;
OpPending := false;
Changes := false;
end; {with}
end;
procedure FindWhatToPrint;
var
kind: integer;
WhichWindow: WindowPtr;
begin
WhatToPrint := NothingToPrint;
WhichWindow := FrontWindow;
if WhichWindow = nil then
exit(FindWhatToPrint);
kind := WindowPeek(WhichWindow)^.WindowKind;
if (kind = PicKind) and info^.RoiShowing and measuring then
kind := valuesKind;
case kind of
PicKind:
if info^.RoiShowing then
WhatToPrint := PrintSelection
else
WhatToPRint := PrintImage;
HistoKind:
WhatToPrint := PrintHistogram;
ProfilePlotKind, CalibrationPlotKind:
WhatToPrint := PrintPlot;
ValuesKind, ResultsKind:
if mCount > 0 then
WhatToPrint := PrintMeasurements;
TextKind:
WhatToPrint := PrintText;
otherwise
;
end;
if (WhatToPrint = NothingToPRint) and (info <> NoInfo) then
WhatToPrint := PrintImage;
end;
procedure UpdateFileMenu;
var
ShowItems, isSelection: boolean;
i: integer;
str, str2: str255;
begin
with info^ do begin
ShowItems := Info <> NoInfo;
isSelection := RoiShowing and (RoiType = RectRoi);
if OptionKeyWasDown and (CurrentKind <> TextKind) then begin
SetItem(FileMenuH, CloseItem, 'Close All…');
SetItem(FileMenuH, SaveItem, 'Save All');
SetMenuItem(FileMenuH, CloseItem, ShowItems);
end
else begin
SetItem(FileMenuH, CloseItem, 'Close…');
if isSelection and (CurrentKind <> TextKind) and (PictureType <> TiffFile) and (PictureType <> PictFile) and (CurrentKind = PicKind) then
SetItem(FileMenuH, SaveItem, 'Save Selection')
else
SetItem(FileMenuH, SaveItem, 'Save');
SetMenuItem(FileMenuH, CloseItem, ShowItems or (CurrentKind = TextKind) or (CurrentKind = ProfilePlotKind) or (CurrentKind = CalibrationPlotKind) or (CurrentKind = HistoKind));
end;
case CurrentKind of
ProfilePlotKind, CalibrationPlotKind:
ExportAsWhat := asPlotValues;
HistoKind:
ExportAsWhat := asHistogramValues;
ResultsKind:
ExportAsWhat := asMeasurements;
PicKind: begin
if (SaveAsWhat <> asPICT) then
SaveAsWhat := asTiff;
if (ExportAsWhat > asText) then
ExportAsWhat := asRaw;
end;
otherwise
end;
if isSelection and (SaveAsWhat <> AsPalette) and (CurrentKind <> ResultsKind) and (CurrentKind <> TextKind) then